package com.genITeam.ria.dao;

import org.hibernate.Session;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import com.genITeam.ria.exception.NGFException;
import com.genITeam.ria.vo.*;

public class ThreadDAO {

	public ThreadDAO() {

		BasicConfigurator.configure();
	}

	Logger logger = Logger.getLogger(ThreadDAO.class);

	/**
	 * saveThread to save the Thread
	 * 
	 * 
	 * @param Posts
	 * @return none
	 * @throws NGFException
	 */
	public void saveThread(Posts threadPostVo, Session session)
			throws NGFException {

		try {
			logger.info("start saveThread");
			session.saveOrUpdate(threadPostVo);
		} catch (Exception e) {
			logger.error("Exception =" + e.toString());
			throw new NGFException(e.getMessage());

		}

	}

	/**
	 * replyThread to save the reply
	 * 
	 * 
	 * @param Posts
	 * @return none
	 * @throws NGFException
	 */
	public void replyThread(Posts threadPostVo, Session session)
			throws NGFException {

		try {
			logger.info("Start reply thread");
			session.saveOrUpdate(threadPostVo);

		} catch (Exception e) {
			logger.error("Exception=" + e.toString());
			throw new NGFException(e.getMessage());

		}

	}

}